package com.melody.android.ui.activity

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.WindowCompat

open class BaseActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setImmersiveStatusBar()
    }

    /**
     * 设置沉浸式状态栏
     */
    private fun setImmersiveStatusBar() {
        // DecorView不再为SystemUI(状态栏和导航栏)预留padding
        WindowCompat.setDecorFitsSystemWindows(window, false)
        val controller = WindowCompat.getInsetsController(window, window.decorView)
        // 状态栏设置为亮色(状态栏的文字、图标颜色为暗色)
        controller.isAppearanceLightStatusBars = true
    }

}